package backtracking.nowcoder.medium;

import java.util.Scanner;

/**
 * @author bruin_du
 * @description 蘑菇阵
 * @date 2022/6/29 17:08
 **/
public class MushroomArray {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        while(in.hasNextInt()) {
            int row = in.nextInt();
            int col = in.nextInt();
            int[][] arr = new int[row][col];
            int allWays  = countWay(arr,row,col,0,0);
            int[][] newArr = new int[row][col];
            int k = in.nextInt();
            for (int i = 0; i < k; i++) {
                int m = in.nextInt();
                int n = in.nextInt();
                newArr[m - 1][n - 1] = 1;
            }
            int ways = countWay(newArr,row,col,0,0);
            System.out.printf("%.2f",(double)ways / allWays);
        }
    }

    private static int countWay(int[][] arr, int row, int col, int i, int j) {
        if(i >= row || j >= col || arr[i][j] == 1) {
            return 0;
        }
        if(i == row - 1 && j == col - 1) {
            return 1;
        }
        arr[i][j] = 1;
        int count = countWay(arr, row, col, i + 1, j) + countWay(arr, row, col, i, j + 1);
        arr[i][j] = 0;
        return count;
    }
}
